<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    

    <title>{$Think.config.site.title} - 订单详情</title>
    <meta name="keywords" content="{$Think.config.site.keywords}">
    <meta name="description" content="{$Think.config.site.description}">

    <link href="{$Think.config.site.resource_url}css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/animate.min.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/style.min.css?v=4.0.0" rel="stylesheet">

</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
      <form method="get" class="form-horizontal">
      <div class="row">
          <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>订单详情</h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                      	</div>
                    </div>
                    <div class="ibox-content">
						<h3 class="order_info">订单号：{$order.order_no}</h3>
						<h3 class="order_info">下单时间：{$order.create_time}</h3>
						<h3>订单状态：
							{switch name="$order['order_status']"}
								{case value="0"}待付款{/case}
								{case value="20"}已支付{/case}
								{case value="25"}待补价{/case}
								{case value="30"}备货中{/case}
								{case value="40"}待收货{/case}
								{case value="100"}已完成{/case}
								{case value="10"}已取消{/case}
								{default /}--
							{/switch}
							<select class="input-sm change_order_status" data-id="{$order['order_id']}">
								<option value="20" {if condition="$order['order_status'] eq 20"}selected="selected"{/if}>已支付</option>
								<option value="30" {if condition="$order['order_status'] eq 30"}selected="selected"{/if}>备货中</option>
								<option value="40" {if condition="$order['order_status'] eq 40"}selected="selected"{/if}>待收货</option>
								<option value="100" {if condition="$order['order_status'] eq 100"}selected="selected"{/if}>已完成</option>
								<option value="10" {if condition="$order['order_status'] eq 10"}selected="selected"{/if}>已取消</option>
							</select>
						</h3>
						</br>
						{if($order_change)}
							<h4 style="clear: both;">改价：</h4>
							<table class="table">
								{volist name="order_change" id="vo"}
								<tr>
									<td width="100">第{$i}次改价：</td>
									<td>{$vo.time}</td>
									<td>{$vo.goods_name}</td>
									<td>{$vo.price}</td>
									<td>{$vo.remark}</td>
									<td></td>
								</tr>
								{/volist}
							</table>
						{/if}
						{if($order_return)}
							<h4>退货：</h4>
							<table class="table">
								{volist name="order_return" id="vo"}
								<tr>
									<td width="100">第{$i}次退货：</td>
									<td>{$vo.rg_time}</td>
									<td>{$vo.goods_name}</td>
									<td>{$vo.rg_num}</td>
									<td>{$vo.return_money*$vo.rg_num}</td>
									<td>{$vo.rg_remark}</td>
								</tr>
								{/volist}
							</table>
						{/if}
						<h3 class="order_info">客户签名：<img src="{$order.signature}" width="200"/>&nbsp;签名时间：{$order.sign_time}</h3>	
                    </div>
                </div>
            </div>
        </div>
        </form>
    </div>

    <script src="{$Think.config.site.resource_url}js/jquery.min.js?v=2.1.4"></script>
    <script src="{$Think.config.site.resource_url}js/bootstrap.min.js?v=3.3.5"></script>
    <script src="{$Think.config.site.resource_url}js/content.min.js?v=1.0.0"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/validate/jquery.validate.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/validate/messages_zh.min.js"></script>
  	<script src="{$Think.config.site.resource_url}js/plugins/layer/layer.js"></script>
  	<script src="{$Think.config.site.resource_url}js/plugins/iCheck/icheck.min.js"></script>
  	<script src="{$Think.config.site.common_resource_url}js/majax.js"></script>
  	<script src="{$Think.config.site.common_resource_url}js/laydate/laydate.js"></script>
</body>

</html>
<script>
function upsuccess(d){
	if (d.code>0) {
		$('#show_brand_logo').attr('src',d.data);
	}else{
		layer.msg(d.msg, {icon: 5});
	}
}
function uperror(e){
	layer.msg('网络出错！', {icon: 5});
}

$(document).ready(function(){

	$("input").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",});

	$("form").validate({
	  debug:true,
	  submitHandler:function(form){
            save();   
      },    
	  rules: {
		brand_name: {
		  required: true,
		},
		brand_sort: {
		  number:true,
		},

	  },
	  messages: {
		brand_name: {
		  required: '广告名必须填写',
		},
		brand_sort: {
		  number: '只能输入数字',
		},
	  }
	});

	function save(){
		var fomrData = $("form").serialize();

		majax('{:url("edit")}',fomrData,function(d){
			if (d.code>0) {
				window.parent.editSuccess(d);
			}else{
				layer.msg(d.msg, {icon: 5});
			}
		})
	};
	
	function editSuccess(d) {
		layer.close(layer_font);
		layer.msg(d.msg, { icon: 1 }, function () {
			location.reload(true);
		});
	};
	
	$(document).on('change','.change_order_status',function(){
		if(confirm('确定修改订单状态吗?')){
			var order_status = $(this).val();
			var order_id = $(this).data('id');
			majax('{:url("update")}',{order_status: order_status,order_id: order_id},function(msg){
				if(msg.code == 1){
					window.parent.editSuccess(msg);
				}else{
					layer.msg(msg.msg,{icon: 5});
				}
			});
		}
	});
})
</script>